#include"processbar.h"

const char BODY = '=';
const char FINISH = '>';
const char* str = "|/-|\\";
char bar[NUM];

void processbar(int rate) // 调用的方法
{
	int len = strlen(str);	
	printf(GREEN"[%-100s]"NONE"[%d%%][%c]\r", bar, rate, str[rate%len]);
	
	fflush(stdout);
	usleep(10000);
	bar[rate++] = BODY;
	if(rate < 100) bar[rate] = FINISH;
}

void init()
{
	memset(bar, '\0', sizeof(bar));
}
